<?php
class CommonComponent extends Object
{
	var $controller = null;

	function startup(&$controller)
	{
		$this->controller = &$controller;
	}
	//lfx added 2013-12-13 start 
	function relative_path_set($htmlstr)
	{
		$htmlstr=str_replace('src="http://localhost:82/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://localhost:82/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://localhost:82/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://localhost:82/','src="/',$htmlstr);
		
		$htmlstr=str_replace('href="http://localhost:82/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://localhost:82/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://localhost:82/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://localhost:82/','href="/',$htmlstr);
		
		$htmlstr=str_replace('URL=http://localhost:82/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://localhost:82/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://localhost:82/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://localhost:82/','URL=/',$htmlstr);
		
		$htmlstr=str_replace('src="http://kamome.asia/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://kamome.asia/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://www.kamome.asia/','src="/',$htmlstr);
		$htmlstr=str_replace('src="http://www.kamome.asia/','src="/',$htmlstr);
		
		$htmlstr=str_replace('href="http://kamome.asia/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://kamome.asia/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://www.kamome.asia/','href="/',$htmlstr);
		$htmlstr=str_replace('href="http://www.kamome.asia/','href="/',$htmlstr);
		
		$htmlstr=str_replace('URL=http://kamome.asia/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://kamome.asia/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://www.kamome.asia/','URL=/',$htmlstr);
		$htmlstr=str_replace('URL=http://www.kamome.asia/','URL=/',$htmlstr);

		$htmlstr=str_replace('attention_url/localhost:82/','/',$htmlstr);
		$htmlstr=str_replace('attention_url/localhost:82/','/',$htmlstr);
		$htmlstr=str_replace('attention_url/kamome.asia/','/',$htmlstr);
		$htmlstr=str_replace('attention_url/www.kamome.asia/','/',$htmlstr);
		
		return $htmlstr;
	}
	//lfx added 2013-12-13 end
	function getMemberDataById($member_id){
		$dbM = $this->controller->Member->find(
				"\"Member\".id =" . $member_id . " and \"Member\".deleted is null");
		return $dbM;
	}
	
	function getMemberfieldsDataById($member_id, $fields = null, $order = null){
		$dbM = $this->controller->Member->find(
				"\"Member\".id =" . $member_id . " and \"Member\".deleted is null",
				$fields,
				$order);
		return $dbM;
	}
	
	function getMemberResumeDataByMemberid($member_id, $fields = null, $order = null){
		$dbMR = $this->controller->MemberResume->find(
				"\"MemberResume\".member_id =" . $member_id . " and \"MemberResume\".deleted is null",
				$fields, 
				$order);
		return $dbMR;
	}
	
	function getMemberEducationDataByMemberid($member_id, $fields = null, $order = null){
		$dbME = $this->controller->MemberEducation->findAll(
				"\"MemberEducation\".member_id=" . $member_id . " and \"MemberEducation\".deleted is null",
				$fields, 
				$order);
		return $dbME;
	}
	
	function getMemberWorkDataByMemberid($member_id, $fields = null, $order = null){
		$dbMW = $this->controller->MemberWork->findAll(
				"\"MemberWork\".member_id=" . $member_id . " and \"MemberWork\".deleted is null",
				$fields, 
				$order);
		return $dbMW;
	}
	
	function getMemberExpWorktypeDataByMemberid($member_id, $fields = null, $order = null){
		$dbMEW = $this->controller->MemberExpWorktype->findAll(
				"\"MemberExpWorktype\".member_id=" . $member_id . " and \"MemberExpWorktype\".deleted is null",
				$fields, 
				$order);
		return $dbMEW;
	}
	
	function updateMemberInfoAndMemberResumePoint($member_id){
		//$commom = & new CommonComponent();
		$fields = " id,
		overseas_edu1_nation,overseas_edu1_period,overseas_edu1_purpose,
		overseas_edu2_nation,overseas_edu2_period,overseas_edu2_purpose,
		overseas_edu3_nation,overseas_edu3_period,overseas_edu3_purpose,
		overseas_work1_nation,overseas_work1_period,overseas_work1_position,
		overseas_work2_nation,overseas_work2_period,overseas_work2_position,
		overseas_work3_nation,overseas_work3_period,overseas_work3_position,
		foreign_lang1,foreign_lang_level1,
		foreign_lang2,foreign_lang_level2,
		foreign_lang3,foreign_lang_level3,
		foreign_lang4,foreign_lang_level4,
		foreign_lang5,foreign_lang_level5,
		toeic_level,toeic_qualification,work_visa_flg,
		qualification,change_work_will,change_work_ym,
		hope_work_location1,hope_work_location2,hope_work_location3,
		hope_category1,hope_worktype1_big,hope_worktype1_small,
		hope_category2,hope_worktype2_big,hope_worktype2_small,
		hope_category3,hope_worktype3_big,hope_worktype3_small,
		hope_income_flg";
		$dbM= $this->getMemberfieldsDataById($member_id);
	
		$member_point = 0;
		$memberresume_point = 0;
		$count3 = 3;
		//print_r($dbM);
		if(!empty($dbM['Member']['overseas_edu1_nation']) || !empty($dbM['Member']['overseas_edu2_nation']) || !empty($dbM['Member']['overseas_edu3_nation'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['overseas_edu1_period']) || !empty($dbM['Member']['overseas_edu2_period']) || !empty($dbM['Member']['overseas_edu3_period'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['overseas_edu1_purpose']) || !empty($dbM['Member']['overseas_edu2_purpose']) || !empty($dbM['Member']['overseas_edu3_purpose'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['overseas_work1_nation']) || !empty($dbM['Member']['overseas_work2_nation']) || !empty($dbM['Member']['overseas_work3_nation'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['overseas_work1_period']) || !empty($dbM['Member']['overseas_work2_period']) || !empty($dbM['Member']['overseas_work3_period'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['overseas_work1_position']) || !empty($dbM['Member']['overseas_work2_position']) || !empty($dbM['Member']['overseas_work3_position'])){
			$member_point =$member_point+2;
		}
		
		//@author wang.wei 2012/3/19 update start
		if(!empty($dbM['Member']['foreign_lang1']) || !empty($dbM['Member']['foreign_lang2']) || !empty($dbM['Member']['foreign_lang3']) || !empty($dbM['Member']['foreign_lang4']) || !empty($dbM['Member']['foreign_lang5'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['foreign_lang_level1']) || !empty($dbM['Member']['foreign_lang_level2']) || !empty($dbM['Member']['foreign_lang_level3']) || !empty($dbM['Member']['foreign_lang_level4']) || !empty($dbM['Member']['foreign_lang_level5'])){
			$member_point =$member_point+2;
		}
		//@author wang.wei 2012/3/19 update end
		
		if(!empty($dbM['Member']['toeic_level'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['toeic_qualification'])){
			$member_point =$member_point+2;
		}
		if(($dbM['Member']['work_visa_flg'] == '0') || ($dbM['Member']['work_visa_flg'] == '1')){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['qualification'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['change_work_will'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['change_work_ym'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_work_location_flg'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_work_location1']) || !empty($dbM['Member']['hope_work_location2']) || !empty($dbM['Member']['hope_work_location3'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_category1']) || !empty($dbM['Member']['hope_category2']) || !empty($dbM['Member']['hope_category3'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_worktype1_big']) || !empty($dbM['Member']['hope_worktype2_big']) || !empty($dbM['Member']['hope_worktype3_big'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_worktype1_small']) || !empty($dbM['Member']['hope_worktype2_small']) || !empty($dbM['Member']['hope_worktype3_small'])){
			$member_point =$member_point+2;
		}
		if(!empty($dbM['Member']['hope_income_flg']) && ($dbM['Member']['hope_income_flg']) == '2'){
			$member_point =$member_point+2;
		}
	
		$dbMEW = $this->getMemberExpWorktypeDataByMemberid($member_id,
				null,
				"\"MemberExpWorktype\".id asc");
	
		for($i=0; $i<count($dbMEW); $i++){
			if(!empty($dbMEW[$i]['MemberExpWorktype']['exp_category'])){
				$member_point =$member_point+2;
				break;
			}
		}
		for($i=0; $i<count($dbMEW); $i++){
			if(!empty($dbMEW[$i]['MemberExpWorktype']['exp_worktype_big'])){
				$member_point = $member_point+2;
				break;
			}
		}
		for($i=0; $i<count($dbMEW); $i++){
			if(!empty($dbMEW[$i]['MemberExpWorktype']['exp_worktype_small'])){
				$member_point = $member_point+2;
				break;
			}
		}
		for($i=0; $i<count($dbMEW); $i++){
			if(!empty($dbMEW[$i]['MemberExpWorktype']['exp_year'])){
				$member_point = $member_point+2;
				break;
			}
		}
	
	
		$me_flag=false;
		$dbME = $this->getMemberEducationDataByMemberid($member_id,
				null,
				"\"MemberEducation\".id asc");
		for($i=0; $i<count($dbME); $i++){
			if(!empty($dbME[$i]['MemberEducation']['edu_school'])){
				$memberresume_point = $memberresume_point+10;
				break;
			}
		}
		for($i=0; $i<count($dbME); $i++){
			if(!empty($dbME[$i]['MemberEducation']['edu_dep'])){
				$memberresume_point = $memberresume_point+10;
				$me_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbME); $i++){
			if(!empty($dbME[$i]['MemberEducation']['edu_degree']) && !$me_flag){
				$memberresume_point = $memberresume_point+10;
				$me_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbME); $i++){
			if(!empty($dbME[$i]['MemberEducation']['edu_start']) && !$me_flag){
				$memberresume_point = $memberresume_point+10;
				$me_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbME); $i++){
			if(!empty($dbME[$i]['MemberEducation']['edu_end']) && !$me_flag){
				$memberresume_point = $memberresume_point+10;
				$me_flag = true;
				break;
			}
		}
	
		$mw_flag = false;
		$dbMW = $this->getMemberWorkDataByMemberid($member_id,
				null,
				"\"MemberWork\".id asc");
		for($i=0; $i<count($dbMW); $i++){
			if(!empty($dbMW[$i]['MemberWork']['exp_work_locaiton'])){
				$memberresume_point = $memberresume_point+10;
				break;
			}
		}
		for($i=0; $i<count($dbMW); $i++){
			if((!empty($dbMW[$i]['MemberWork']['exp_work_start_year']) || !empty($dbMW[$i]['MemberWork']['exp_work_end_year'])) && !$mw_flag){
				$memberresume_point = $memberresume_point+10;
				$mw_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbMW); $i++){
			if((($dbMW[$i]['MemberWork']['exp_work_flg']) == '0') && !$mw_flag){
				$memberresume_point = $memberresume_point+10;
				$mw_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbMW); $i++){
			if(!empty($dbMW[$i]['MemberWork']['exp_work_position']) && !$mw_flag){
				$memberresume_point = $memberresume_point+10;
				$mw_flag = true;
				break;
			}
		}
		for($i=0; $i<count($dbMW); $i++){
			if(!empty($dbMW[$i]['MemberWork']['exp_work_emp_type']) && !$mw_flag){
				$memberresume_point = $memberresume_point+10;
				$mw_flag = true;
				break;
			}
		}
	
		$dbMR = $this->getMemberResumeDataByMemberid($member_id);
	
		if(!empty($dbMR['MemberResume']['now_income'])){
			$memberresume_point = $memberresume_point+5;
		}
		if(!empty($dbMR['MemberResume']['exp_company'])){
			$memberresume_point = $memberresume_point+5;
		}
		if( $dbMR['MemberResume']['note_length'] >= 100 && $dbMR['MemberResume']['note_length'] < 500){
			$memberresume_point = $memberresume_point+10;
		}
		else if($dbMR['MemberResume']['note_length'] >= 500 && $dbMR['MemberResume']['note_length'] < 1000){
			$memberresume_point = $memberresume_point+20;
		}
		else if($dbMR['MemberResume']['note_length'] >= 1000){
			$memberresume_point = $memberresume_point+30;
		}
	
		$this->controller->MemberResume->updateMemberResumePoint($dbMR['MemberResume']['id'],$memberresume_point);
		$this->controller->Member->updateMemberPoint($dbM['Member']['id'],$member_point);
	
	}
	
	function checkMemberMultiLine($dbM,$op){
		$oenCount=0;
		$ownCount=0;
		$langCount=0;
		$hwlCount=0;
		$hcCount=0;
		$hwCount=0;
		$MArray = Array();
		
		if(!empty($dbM['Member']['overseas_edu1_nation']) || !empty($dbM['Member']['overseas_edu1_period']) || !empty($dbM['Member']['overseas_edu1_purpose'])){
			$MArray['OE']['overseas_edu_nation'][$oenCount] = $dbM['Member']['overseas_edu1_nation'];
			$MArray['OE']['overseas_edu_period'][$oenCount] = $dbM['Member']['overseas_edu1_period'];
			$MArray['OE']['overseas_edu_purpose'][$oenCount] = $dbM['Member']['overseas_edu1_purpose'];
			$oenCount++;
		}
		if(!empty($dbM['Member']['overseas_edu2_nation']) || !empty($dbM['Member']['overseas_edu2_period']) || !empty($dbM['Member']['overseas_edu2_purpose'])){
			$MArray['OE']['overseas_edu_nation'][$oenCount] = $dbM['Member']['overseas_edu2_nation'];
			$MArray['OE']['overseas_edu_period'][$oenCount] = $dbM['Member']['overseas_edu2_period'];
			$MArray['OE']['overseas_edu_purpose'][$oenCount] = $dbM['Member']['overseas_edu2_purpose'];
			$oenCount++;
		}
		if(!empty($dbM['Member']['overseas_edu3_nation']) || !empty($dbM['Member']['overseas_edu3_period']) || !empty($dbM['Member']['overseas_edu3_purpose'])){
			$MArray['OE']['overseas_edu_nation'][$oenCount] = $dbM['Member']['overseas_edu3_nation'];
			$MArray['OE']['overseas_edu_period'][$oenCount] = $dbM['Member']['overseas_edu3_period'];
			$MArray['OE']['overseas_edu_purpose'][$oenCount] = $dbM['Member']['overseas_edu3_purpose'];
			$oenCount++;
		}
		if($oenCount==0){
			$MArray['OE']['overseas_edu_nation'][$oenCount] = '';
			$MArray['OE']['overseas_edu_period'][$oenCount] = '';
			$MArray['OE']['overseas_edu_purpose'][$oenCount] = '';
			$oenCount++;
		}
		$MArray['OE']['count']=$oenCount;
		
		if(!empty($dbM['Member']['overseas_work1_nation']) || !empty($dbM['Member']['overseas_work1_period']) || !empty($dbM['Member']['overseas_work1_position'])){
			$MArray['OW']['overseas_work_nation'][$ownCount] = $dbM['Member']['overseas_work1_nation'];
			$MArray['OW']['overseas_work_period'][$ownCount] = $dbM['Member']['overseas_work1_period'];
			$MArray['OW']['overseas_work_position'][$ownCount] = $dbM['Member']['overseas_work1_position'];
			$ownCount++;
		}
		if(!empty($dbM['Member']['overseas_work2_period']) || !empty($dbM['Member']['overseas_work2_period']) || !empty($dbM['Member']['overseas_work2_position'])){
			$MArray['OW']['overseas_work_nation'][$ownCount] = $dbM['Member']['overseas_work2_nation'];
			$MArray['OW']['overseas_work_period'][$ownCount] = $dbM['Member']['overseas_work2_period'];
			$MArray['OW']['overseas_work_position'][$ownCount] = $dbM['Member']['overseas_work2_position'];
			$ownCount++;
		}
		if(!empty($dbM['Member']['overseas_work3_period']) || !empty($dbM['Member']['overseas_work3_period']) || !empty($dbM['Member']['overseas_work3_position'])){
			$MArray['OW']['overseas_work_nation'][$ownCount] = $dbM['Member']['overseas_work3_nation'];
			$MArray['OW']['overseas_work_period'][$ownCount] = $dbM['Member']['overseas_work3_period'];
			$MArray['OW']['overseas_work_position'][$ownCount] = $dbM['Member']['overseas_work3_position'];
			$ownCount++;
		}
		if($ownCount==0){
			$MArray['OW']['overseas_work_nation'][$ownCount] = '';
			$MArray['OW']['overseas_work_period'][$ownCount] = '';
			$MArray['OW']['overseas_work_position'][$ownCount] = '';
			$ownCount++;
		}
		$MArray['OW']['count']=$ownCount;
		
		//@author wang.wei 2012/3/19 update start
		if(!empty($dbM['Member']['foreign_lang1']) || !empty($dbM['Member']['foreign_lang_level1'])){
			$MArray['Lang']['foreign_lang'][$langCount] = $dbM['Member']['foreign_lang1'];
			$MArray['Lang']['foreign_lang_level'][$langCount] = $dbM['Member']['foreign_lang_level1'];
			$langCount++;
		}
		if(!empty($dbM['Member']['foreign_lang2']) || !empty($dbM['Member']['foreign_lang_level2'])){
			$MArray['Lang']['foreign_lang'][$langCount] = $dbM['Member']['foreign_lang2'];
			$MArray['Lang']['foreign_lang_level'][$langCount] = $dbM['Member']['foreign_lang_level2'];
			$langCount++;
		}
		if(!empty($dbM['Member']['foreign_lang3']) || !empty($dbM['Member']['foreign_lang_level3'])){
			$MArray['Lang']['foreign_lang'][$langCount] = $dbM['Member']['foreign_lang3'];
			$MArray['Lang']['foreign_lang_level'][$langCount] = $dbM['Member']['foreign_lang_level3'];
			$langCount++;
		}
		if(!empty($dbM['Member']['foreign_lang4']) || !empty($dbM['Member']['foreign_lang_level4'])){
			$MArray['Lang']['foreign_lang'][$langCount] = $dbM['Member']['foreign_lang4'];
			$MArray['Lang']['foreign_lang_level'][$langCount] = $dbM['Member']['foreign_lang_level4'];
			$langCount++;
		}
		if(!empty($dbM['Member']['foreign_lang5']) || !empty($dbM['Member']['foreign_lang_level5'])){
			$MArray['Lang']['foreign_lang'][$langCount] = $dbM['Member']['foreign_lang5'];
			$MArray['Lang']['foreign_lang_level'][$langCount] = $dbM['Member']['foreign_lang_level5'];
			$langCount++;
		}
		if($langCount==0){
			$MArray['Lang']['foreign_lang'][$langCount] = '';
			$MArray['Lang']['foreign_lang_level'][$langCount] = '';
			$langCount++;
		}
		$MArray['Lang']['count']=$langCount;
		/* if($op=='insert'){
			if(!empty($dbM['Member']['first_lang']) || !empty($dbM['Member']['first_lang_level'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['first_lang'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['first_lang_level'];
				$langCount++;
			}
			if(!empty($dbM['Member']['second_lang']) || !empty($dbM['Member']['second_lang_level'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['second_lang'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['second_lang_level'];
				$langCount++;
			}
			if(!empty($dbM['Member']['third_lang']) || !empty($dbM['Member']['third_lang_level'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['third_lang'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['third_lang_level'];
				$langCount++;
			}
			if($langCount==0){
				$MArray['Lang']['lang'][$langCount] = '';
				$MArray['Lang']['lang_level'][$langCount] = '';
				$langCount++;
			}
			$MArray['Lang']['count']=$langCount;
		}else{
			if(!empty($dbM['Member']['lang1']) || !empty($dbM['Member']['lang_level1'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['lang1'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['lang_level1'];
				$langCount++;
			}
			if(!empty($dbM['Member']['lang2']) || !empty($dbM['Member']['lang_level2'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['lang2'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['lang_level2'];
				$langCount++;
			}
			if(!empty($dbM['Member']['lang3']) || !empty($dbM['Member']['lang_level3'])){
				$MArray['Lang']['lang'][$langCount] = $dbM['Member']['lang3'];
				$MArray['Lang']['lang_level'][$langCount] = $dbM['Member']['lang_level3'];
				$langCount++;
			}
			if($langCount==0){
				$MArray['Lang']['lang'][$langCount] = '';
				$MArray['Lang']['lang_level'][$langCount] = '';
				$langCount++;
			}
			$MArray['Lang']['count']=$langCount;
		} */
		//@author wang.wei 2012/3/19 update end
		
		if(!empty($dbM['Member']['hope_work_location1'])){
			$MArray['HWL']['hope_work_location'][$hwlCount] = $dbM['Member']['hope_work_location1'];
			$hwlCount++;
		}
		if(!empty($dbM['Member']['hope_work_location2'])){
			$MArray['HWL']['hope_work_location'][$hwlCount] = $dbM['Member']['hope_work_location2'];
			$hwlCount++;
		}
		if(!empty($dbM['Member']['hope_work_location3'])){
			$MArray['HWL']['hope_work_location'][$hwlCount] = $dbM['Member']['hope_work_location3'];
			$hwlCount++;
		}
		if($hwlCount==0){
			$MArray['HWL']['hope_work_location'][$hwlCount] = '';
			$hwlCount++;
		}
		$MArray['HWL']['count']=$hwlCount;
		
		if(!empty($dbM['Member']['hope_category1'])){
			$MArray['HC']['hope_category'][$hcCount] = $dbM['Member']['hope_category1'];
			$hcCount++;
		}
		if(!empty($dbM['Member']['hope_category2'])){
			$MArray['HC']['hope_category'][$hcCount] = $dbM['Member']['hope_category2'];
			$hcCount++;
		}
		if(!empty($dbM['Member']['hope_category3'])){
			$MArray['HC']['hope_category'][$hcCount] = $dbM['Member']['hope_category3'];
			$hcCount++;
		}
		if($hcCount==0){
			$MArray['HC']['hope_category'][$hcCount] = '';
			$hcCount++;
		}
		$MArray['HC']['count']=$hcCount;
		
		if(!empty($dbM['Member']['hope_worktype1_big']) || !empty($dbM['Member']['hope_worktype1_small'])){
			$MArray['HW']['hope_category'][$hwCount] = $dbM['Member']['hope_category1'];
			$MArray['HW']['hope_worktype_big'][$hwCount] = $dbM['Member']['hope_worktype1_big'];
			$MArray['HW']['hope_worktype_small'][$hwCount] = $dbM['Member']['hope_worktype1_small'];
			$hwCount++;
		}
		if(!empty($dbM['Member']['hope_worktype2_big']) || !empty($dbM['Member']['hope_worktype2_small'])){
			$MArray['HW']['hope_category'][$hwCount] = $dbM['Member']['hope_category2'];
			$MArray['HW']['hope_worktype_big'][$hwCount] = $dbM['Member']['hope_worktype2_big'];
			$MArray['HW']['hope_worktype_small'][$hwCount] = $dbM['Member']['hope_worktype2_small'];
			$hwCount++;
		}
		if(!empty($dbM['Member']['hope_worktype3_big']) || !empty($dbM['Member']['hope_worktype3_small'])){
			$MArray['HW']['hope_category'][$hwCount] = $dbM['Member']['hope_category3'];
			$MArray['HW']['hope_worktype_big'][$hwCount] = $dbM['Member']['hope_worktype3_big'];
			$MArray['HW']['hope_worktype_small'][$hwCount] = $dbM['Member']['hope_worktype3_small'];
			$hwCount++;
		}
		if($hwCount==0){
			$MArray['HW']['hope_category'][$hwCount] = '';
			$MArray['HW']['hope_worktype_big'][$hwCount] = '';
			$MArray['HW']['hope_worktype_small'][$hwCount] = '';
			$hwCount++;
		}
		$MArray['HW']['count']=$hwCount;
		
		$dbM['DBM']=$MArray;
		return $dbM;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
}